一轉眼鐵人賽只剩下十天,從今天開始我們將一步一步搭建出電子商城所需要的模組,例如需要會員系統可以註冊登入、需要商品展示並可以上傳商品等
CREATE TABLE [dbo].[Members]
(
[Account] NVARCHAR(50) NOT NULL PRIMARY KEY,
[Password] NVARCHAR(50) NOT NULL,
[Name] NVARCHAR(10) NOT NULL,
[Email] VARCHAR(100) NOT NULL,
[AuthCode] NCHAR(10) NOT NULL,
[IsAdmin] BIT NOT NULL DEFAULT 0
)
CREATE TABLE [dbo].[Item]
(
[Id] INT NOT NULL PRIMARY KEY,
[Name] NVARCHAR(50) NOT NULL,
[Price] INT NOT NULL,
[Image] NVARCHAR(MAX) NOT NULL
)
CREATE TABLE [dbo].[CartSave]
(
[Account] NVARCHAR(50) NOT NULL PRIMARY KEY,
[Cart_Id] VARCHAR(50) NOT NULL
FOREIGN KEY(Account) REFERENCES Members(Account)
)
CREATE TABLE [dbo].[CartBuy]
(
[Cart_Id] VARCHAR(50) NOT NULL ,
[Item_Id] INT NOT NULL,
PRIMARY KEY ([Cart_Id],[Item_Id]),
FOREIGN KEY(Item_Id) REFERENCES Item(Id)
)